Skip to content

fix(1845): CSS special selector ":host" only work first time #1852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2019
Merged

fix(1845): CSS special selector ":host" only work first time #1852

merged 2 commits into from
Jun 12, 2019

Conversation

m-abs
Copy link
Contributor

@m-abs m-abs commented Jun 8, 2019

PR Checklist

I can't run the unit tests, so I couldn't write a test for this fix.

What is the current behavior?

:host selector only works for on first instance of a component.

This is caused by _nghost-%COMP%-property only being applied when the EmulatedRenderer is created for a type, but not when it is reuse.

What is the new behavior?

The _nghost-%COMP%-property is applied when the EmulatedRenderer is reused.

Fixes #1845

@cla-bot cla-bot bot added the cla: yes label Jun 8, 2019
@VladimirAmiorkov
Copy link
Contributor

run ci

@VladimirAmiorkov
Copy link
Contributor

Hi @m-abs ,

Thank you for this contribution. Can you share with me a code sample that shows the incorrect case when using :host so we can add a test for this case ?

@m-abs
Copy link
Contributor Author

m-abs commented Jun 10, 2019

Hi @VladimirAmiorkov

I wouldn't mind writing a test myself, but as I wrote before I can't run the test project.

There is a playground project in the bug rapport: https://play.nativescript.org/?template=play-ng&id=NXYfcY&v=15

But I can give a quick example here:

Template:

<Label [text]="textValue"></Label>

Stylesheet:

Label {
   background-color: green;
   font-weight: normal;
   font-size: 12;
   horizontal-align: left;
}

:host Label {
   background-color: blue;
   font-weight: bold;
   font-size: 20;
   horizontal-align: center;
}

This should demonstrate the problem, if the component is used more than once.

@VladimirAmiorkov
Copy link
Contributor

Hi @m-abs ,

Thank you for the details. I am currently working on resolving the issues in the tests app that are caused by the --bundle option. Can you try to run it with the legacy workflow that does not trigger --bundle ?

@m-abs
Copy link
Contributor Author

m-abs commented Jun 12, 2019

Hi @VladimirAmiorkov

I managed to run the tests without --bundle, so I could add my test.

@VladimirAmiorkov VladimirAmiorkov merged commit 59a5bd8 into NativeScript:master Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSS special selector ":host" only work first time
2 participants